function Category(jsonObject) {
	this.internalObject = jsonObject;
}

Category.prototype = {
	getCategoryId: function() { return this.internalObject.CategoryId; },
	getCategoryName: function() { return this.internalObject.CategoryName; },
	setCategoryName: function(categoryname) { this.internalObject.CategoryName = categoryname; },
	getDescription: function() { return this.internalObject.Description; },
	setDescription: function(description) { this.internalObject.Description = description; },
	getPicture: function() { return this.internalObject.Picture; },
	setPicture: function(picture) { this.internalObject.Picture = picture; },
	getCreatedDate: function() { return this.internalObject.CreatedDate; },
	getCreatedBy: function() { return this.internalObject.CreatedBy; },
	getModifiedDate: function() { return this.internalObject.ModifiedDate; },
	getModifiedBy: function() { return this.internalObject.ModifiedBy; },
	getCategoryObject: function() { return this.internalObject; }
};

function CategoryService() {
}

CategoryService.prototype.retrieveAll = function(successCallback) {
    viewServiceProxy.invokeGet("CategoryList", successCallback, OnPageError, true);
};

CategoryService.prototype.retrievePaged = function(successCallback, pageIndex, pageSize, sortOrder, sortColumn, linq) {
    var restUrl = "CategoryListPage";
    restUrl = restUrl + "/?";

    if (!IsNullOrEmpty(pageIndex)) {
        restUrl = restUrl + "pageIndex=" + pageIndex;
        if (!IsNullOrEmpty(pageSize) || !IsNullOrEmpty(sortOrder) || !IsNullOrEmpty(sortColumn) || !IsNullOrEmpty(linq)) {
            restUrl = restUrl + "&";
        }
    }
    if (!IsNullOrEmpty(pageSize)) {
        restUrl = restUrl + "pageSize=" + pageSize;
        if (!IsNullOrEmpty(sortOrder) || !IsNullOrEmpty(sortColumn) || !IsNullOrEmpty(linq)) {
            restUrl = restUrl + "&";
        }
    }
    if (!IsNullOrEmpty(sortOrder)) {
        restUrl = restUrl + "sortOrder=" + sortOrder;
        if (!IsNullOrEmpty(sortColumn) || !IsNullOrEmpty(linq)) {
            restUrl = restUrl + "&";
        }
    }
    if (!IsNullOrEmpty(sortColumn)) {
        restUrl = restUrl + "sortColumn=" + sortColumn;
        if (!IsNullOrEmpty(linq)) {
            restUrl = restUrl + "&";
        }
    }
    restUrl = restUrl + "linq=" + linq;

    viewServiceProxy.invokeGet(restUrl, successCallback, OnPageError, true);
};

CategoryService.prototype.save = function(category, successCallback) {
viewServiceProxy.invokePut("Category", category.getCategoryObject(), successCallback, OnPageError, true);
};
